package com.lagou.task1.work4;

import java.util.List;
import java.util.Set;

public class StudentFind {

    public static boolean findStudent(int num, List<Student> list){
        Student student = new Student();
        student.setNum(num);
        int i = list.indexOf(student);
        if (i<0){
            System.out.println("学号为" + num + "的学生不存在");
            return false;
        }
        System.out.println("获取学生信息成功：" + list.get(i));
        return true;
    }

    public static void showStudent(List<Student> list){
        for (Student student : list) {
            System.out.println(student);
        }
    }
}
